|
|
=Bob= wrote:
>
> I need a formula to slowly adjust one value to
> another value over a known period. For example,
> I have an increment value of 1 and I want that
> value to decrease until it's 0 (or some other
> value as needed, 0 for now). And I must reach
> the known period (length in this case).
>
> So I would be doing something like:
>
> somelen = 62;
> incval = 1;
> someotherval = ?
>
> for (x=0;x<somelen;x+=incval)
> {
> incval -= someotherval;
> if (incval <= 0)
> break;
> }
>
> I need x to achieve "somelen" and "incval" to
> achieve the value of 0 at about the same time,
> give or take a bit.
>
> How do I calculate "someotherval" ?
> Thanks for your help.
Since you're asking in povray.general,
I'll answer with a POV script:
#declare StartValue = 31;
#declare EndValue = 3;
#declare NrOfSteps = 10;
#declare dValue = (EndValue - StartValue)/NrOfSteps;
#declare Step = 0;
#while (Step <= NrOfSteps)
#declare X = StartValue + Step*dValue;
#debug "\n"
#debug str(X, 0, -1)
#declare Step = Step + 1;
#end // while
#debug "\n"
Tor Olav
Post a reply to this message
|
|